package com.ff.neuropp.response;

import com.ff.neuropp.domain.Course;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class CourseResponse {

    private String courseTypeName;

    private List<CourseInfo> courses;



    public CourseResponse(String courseTypeName, List<Course> list){
        this.courseTypeName = courseTypeName;
        List<CourseInfo> out = new ArrayList<>();
        if(list!=null && list.size()>0){
            list.forEach(x->{
                CourseInfo info = new CourseInfo(x.getId(),x.getIntro(),x.getCourseDesc(),x.getCourseName());
                out.add(info);
            });
        }
        this.courses = out;
    }
}
